package com.cloud;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.net.InetAddress;

@EnableDiscoveryClient
@SpringBootApplication
public class GateWayMain {

    private static Logger logger = LoggerFactory.getLogger(GateWayMain.class);

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(GateWayMain.class, args);
        Environment environment = context.getBean(Environment.class);
        try {
            String ip = InetAddress.getLocalHost().getHostAddress();
            String port = environment.getProperty("server.port");
            logger.info("knife4j聚合文档平台: http://" + ip + ":" + port + "/doc.html" + "\n");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
